package com.github.lee.unsplash.domain.response

import com.google.gson.annotations.SerializedName

data class BaseResult<T>(
    @SerializedName("code")
    val code: Int = -1,
    @SerializedName("msg")
    val msg: String = "",
    @SerializedName("pageSize")
    val pageSize: Int = 0,
    @SerializedName("total")
    val total: Int = 0,
    @SerializedName("limit")
    val limit: Int = 0,
    @SerializedName("remaining")
    val remaining: Int = 0,
    @SerializedName("data")
    val data: T

) {

    fun isSuccess(): Boolean =
        code in 200..299

    fun hasMore(currentPage: Int): Boolean =
        currentPage * pageSize < total

}